#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
const int N = 3e5 + 10;
map<int, int>mp;
struct node
{
	int a, b;
}S[N];
int n, k;
int cmp(node a, node b)
{
	return a.a < b.a;
}
int main()
{
	cin >> n >> k;
	int sum = 0;
	for (int i = 1; i <= n; i++) {
		int x, y;
		cin >> x >> y;
		sum += y;
		S[i] = { x,y };
	}
	sort(S + 1, S + n + 1, cmp);
	int ans1 = 0;
	if (sum <= k) {
		cout << 1 << endl;
		return 0;
	}
	for (int i = 1; i <= n; i++) {
		sum -= S[i].b;
		//cout << "sum==" << sum << endl;
		if (sum <= k) {
			ans1 = S[i].a;
			cout << ans1 + 1 << endl;
			return 0;
		}
	}
	return 0;
}